﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ThreadModule.Data
{
    /// <summary>
    /// 创建螺纹类，其中泛型T必须继承<see cref="ThreadBase"/>，包括<see cref="CylinderThreadGauge"/>、<see cref="TaperThreadGauge"/>
    /// </summary>
    /// <typeparam name="T">
    /// </typeparam>
    public class ThreadBuilder<T> where T: ThreadBase
    {
        /// <summary>
        /// 螺纹量规
        /// </summary>
        public T gauge { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="threadInformation">螺纹信息类</param>
        /// <param name="threshodAngle">角度判定阈值，默认为2°</param>
        /// <param name="calculationMethod">计算方法<see cref="CalculationMethod"/>默认为迭代方法</param>
        public ThreadBuilder(ref ThreadInformation threadInformation, double threshodAngle = 2.0, CalculationMethod calculationMethod = CalculationMethod.Iterator)
        {
            if (typeof(T)== typeof(CylinderThreadGauge))
            {
                CylinderThreadGauge cylinderThreadGauge = new CylinderThreadGauge(ref threadInformation, threshodAngle, calculationMethod);
            }
            else if (typeof(T) == typeof(TaperThreadGauge))
            {
                TaperThreadGauge taperThreadGauge = new TaperThreadGauge(ref threadInformation, threshodAngle, calculationMethod);
            }
        }
    }
}
